Quickstart Android - Libs
1. Installing the Group Link SDK
The first step is to install the library by linking the dependency in your build.gradle file. This is done through Gradle’s automatic installation.
You will need to add the JitPack repository to your build file. This should be added in your root build.gradle at the end of repositories:
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
Next, in your build.gradle(app) file, download the library to your project by adding the following line. Please note that the minimum compiledSdk is 31.
dependencies{
...
//Add this line
implementation "com.grouplinknetwork:lib-grouplinknetwork:4.5.60"
}
Please note that after integrating Grouplink, you may need to configure multidex.
2. Initialize Group Link
The next step is to initialize the library. This is done by adding the following line inside the Application class of the app that will use the SDK or by adding the line on the method that will initialize the SDK inside the APP:
kotlin
class App : Application() {
override fun onCreate() {
super.onCreate()
...
...
//Grouplink must be initialized inside
//onCreate of the core Application registered.
//add the following line
GroupLink.register(
context.applicationContext,
"<GROUPLINK_TOKEN>",
false //true if you want to test if the implementation is working.
)
}
...
}
You should add as well the following needed permissions on your integration instructions or directly on the AndroidManifest of the SDK:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION " />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<!-- Mandatory permissions for Android 12 and above.-->
<!-- Also, they should be asked in runtime. -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:minSdkVersion="31"
android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<!-- Mandatory permissions for Android 13 and above. -->
<!-- Also, should be asked in runtime. -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
Ideally, the following permissions would help the SDK start the scan even in the worst conditions and environment scenarios:
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION/>